home *** CD-ROM | disk | FTP | other *** search
- scr <- Screen new
- scr setScreenModeID: 16r40D20001
- scr open: 'TestScreen'
-
- win <- Window new: 'Test Key Class:'
-
- win setFlags: 16r100F
- win setIDCMPFlags: 16r140
- win openOnScreen: scr
-
- key <- Key new
- key initialize
-
- key registerTo: win
-
- scr screenToFront
-
- itxt <-IText new: 'Press & release a key (or combination)...'
-
- itxt setPens: 5 @ 2
- itxt setITextOrigin: 0 @ 0
-
- win printIText: itxt at: 100 @ 20
-
- userKey <- key getRawKey
-
- p1 <- Painter new: win
- p1 setAPen: 3
-
- result <- ('You pressed key number ', userKey asString, ' (Raw Key value),')
-
- p1 drawText: result at: 100@35
-
- asciiVal <- key asciiToString: (key translateKey: userKey)
-
- result <- ('which translates to "', asciiVal, '" (Cooked Key value);')
-
- p1 drawText: result at: 100@45
-
- result <- ('The qualifiers (value) was ', ((key keyQualifiers) asString))
-
- p1 drawText: result at: 100@55
-
- p1 drawText: 'Press another key...' at: 100@65
- userKey <- key getVanillaKey
-
- result <- ('You pressed "', (key asciiToString: userKey), '" (Vanilla Key value),')
-
- p1 drawText: result at: 100@75
-
- p1 drawText: 'type: "win close", then "scr close" in the Command' at: 100@170
- p1 drawText: 'String Gadget to clean things up!' at: 100@180
-
- itxt dispose
-